<template>
  <!-- 单击和双击 -->
  <div class="one-double">
    <el-button
      class="tools"
      @click="storageCount"
      @dblclick.native="storageDetail"
    >双击和单</el-button>
  </div>
</template>

<script>
export default {
  name: 'OneAndDouble',
  methods: {
    // 单击
    storageCount() {
      clearTimeout(this.time) // 首先清除计时器
      this.time = null
      this.time = setTimeout(() => {
        console.log(0)
      }, 300) // 大概时间300ms
    },
    // 双击
    storageDetail() {
      // 清除单击事件
      clearTimeout(this.time)
      this.time = null
      console.log(1)
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
